#include <algorithm>
#include <functional>
#include <iostream>
#include <iterator>
int main() {
  int a[] = {1, 3, 5, 7};
  int b[] = {2, 4, 6, 8};
  int N = std::distance(a, std::end(a));
  int *result = new int[N];
  std::transform(a, std::end(a), b, result,
                 std::bit_and<int>()); // result = [0,0,4,0]

  std::transform(a, std::end(a), b, result,
                 std::bit_or<int>()); // result = [3,7,7,15]

  std::transform(a, std::end(a), b, result,
                 std::bit_xor<int>()); // result = [3,7,3,15]

  std::transform(a, std::end(a), b, result,
                 std::divides<int>()); // result = [0,0,0,0]

  std::transform(a, std::end(a), b, result,
                 std::equal_to<int>()); // result = [0,0,0,0]

  std::transform(a, std::end(a), b, result,
                 std::greater<int>()); // result = [0,0,0,0]

  std::transform(a, std::end(a), b, result,
                 std::greater_equal<int>()); // result = [0,0,0,0]

  std::transform(a, std::end(a), b, result,
                 std::less<int>()); // result = [1,1,1,1]

  std::transform(a, std::end(a), b, result,
                 std::less_equal<int>()); // result = [1,1,1,1]

  std::transform(a, std::end(a), b, result,
                 std::logical_and<bool>()); // result = [1,1,1,1]

  std::transform(a, std::end(a), b, result,
                 std::logical_or<bool>()); // result = [0,0,0,0]
  std::transform(a, std::end(a), result,
                 std::logical_not<bool>()); // result = [0,0,0,0],一元运算

  std::transform(a, std::end(a), b, result,
                 std::minus<int>()); // result = [-1,-1,-1,-1]

  std::transform(a, std::end(a), b, result,
                 std::modulus<int>()); // result = [1,3,5,7],元素取余

  std::transform(a, std::end(a), b, result,
                 std::multiplies<int>()); // result = [2,12,30,56]
  std::transform(a, std::end(a), result,
                 std::negate<int>()); // result = [-1,-3,-7,-9]

  std::transform(a, std::end(a), b, result,
                 std::not_equal_to<bool>()); // result = [0,0,0,0]

  std::transform(a, std::end(a), b, result,
                 std::plus<int>()); // result = [3,7,11,15]
  delete[] result;
}
